#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
int a[30];
ll tran(ll n)
{
    ll sum=0;
    ll p=pow(8,10);
    for(int i=11;i>=1;i--)
    {
        if(n>=p)
        {
            a[i]=n/p;
            n=n-n/p*p;
        }
        p/=8;
    }
    for(int i=11;i>=1;i--)
    {
        sum=sum*10+a[i];
    }
    cout<<sum;
    return sum;
}
int main()
{
    ll n;
    cin>>n;
    ll a = tran(n);

	return 0;
}

